Public: Concord Software Projects : OTrunk HowTo
This page last changed on Apr 11, 2009 by aunger.
OTrunk Developers FAQ
How to...Hiding left side view in OTViewerQ. The OTViewer always displays that left side panel with a tree view, but I don't want to show it. How do I take it out? <OTViewBundle showLeftPanel="false" ...
Creating new OT objects from codeQ. I need to create a new OT object (instance) from scratch from my code. The keyword new doesn't seem to work (specially when the ot object is just an interface). How do I do that? Listening to OT changesQ. How do I add an OTChangeListener to an OTObject Getting real objectsQ. How do I get a "real object" out of an OT object? Getting a controller serviceQ. How do I get an OTControllerService object?
Sharing a real objects between viewsQ. I want to share a single real object between 2 views how can I do this? OT object IDsQ. When I reference an ot object, I do <object refid="${local_id}"/>. What is that dollar sign for? OT object IDs - Refer to an object by a local_id instead of its existing global idQ. I want to reference an object or view by a local_id, but it already has/needs to have a global id. Can I do that? <idMap> <idMapping local_id="my-id-1" id="23cc14f0-c44f-11dc-95ff-0800200c9a66"/> <idMapping local_id="my-id-2" id="31193bb0-c44f-11dc-95ff-0800200c9a66"/> </idMap> Now wherever you would use <object refid="23cc14f0-c44f-11dc-95ff-0800200c9a66"/> you can use <object refid="${my-id-1}"/> Getting views from OT objectsQ. I have an ot object, but I need an instance of its view. How do I get that? getJComponentService().getJComponentViewContext().getViewByObject(otObject); If you are in a script, you need to give access to the view to the OTScriptObject in the otml file. To do that, add an OTScriptVariableView entry to the variables section of the OTScriptObject. Then, you can use the view as a normal variable from your script. Writing otml files - Using mapsQ. I want to use a map but I don't know how to write the otml for that. <OTExample> <mapProperty> <entry key="key1"> <OTExampleObject/> </entry> <entry key="key2"> <OTExampleObject/> </entry> </mapProperty> </OTExample> An OTResourceMap allows you to have a table with strings as keys and primitives as values. This is a sample code. Say there is a class called OTExample with an OTResourceMap property called mapProperty. Then the otml would look something like this: <OTExample> <mapProperty> <entry key="key1"> <boolean>true</boolean> </entry> <entry key="key2"> <int>2</int> </entry> </mapProperty> </OTExample> Writing otml files - Including external otml filesQ. I want to reference an object that is defined on a separate otml file that the one I'm writing. Can I do that? <includes> <OTInclude href="my_external_file.otml"/> </includes> Writing otml files - Directly use the root object from an external otml fileQ. I want to directly reference an external without having to first import it and then refer to the id of the object. Can I do that? Use:
<OTIncludeRootObject href="/path/to/otml/file.otml"/>
where you would use
<object refid="${some-external-object}"/>
with the viewClass org.concord.otrunk.OTIncludeRootObjectView Viewing and editing learner data directlyQ. I want to edit a student's otml data by hand and post it to the SDS as a new bundle. http://saildataservice.concord.org/13/offering/7086/jnlp/19407?sailotrunk.learnerotml.edit=true This will launch the SailOTViewer and show you a text representation of the learner's otml. You can then edit this otml by hand, and upload it as a new bundle by closing the window (you will be asked to confirm upload). Note that no xml checking is done at this point, so there are no guarantees on what will happen if the xml is invalid. Get all loaded objects of a certain typeQ. I want to find all loaded OTObjects that match a given Class Example: /* Assume we have an OTObject and an OTrunkImpl object * OTObject otObj = ... * OTrunkImpl otrunk = ... */ // get all objects using the default root object service ArrayList<OTObject> objects = otrunk.getAllObjects(OTMultiUser.class); // get all objects, using a specific object service to resolve the objects ArrayList<OTObject> otherObjects = otrunk.getAllObjects(OTDocument.class, otObj.getObjectService()); Get objects which reference another object, indirectly or directlyQ. I want to find all objects that reference an object directly, or all objects which reference an object indirectly Examples: /* Assume we have an OTObject and an OTrunkImpl object * OTObject otObj = ... * OTObject ignoreObject = ... * OTrunkImpl otrunk = ... */ //public ArrayList<OTID> getReferences(OTID objectID, Class<?> filterClass, boolean recurse, ArrayList<OTID> excludeIDs) // filterClass will filter the collection of references by a certain class, similar to OTrunkImpl.getAllObjects(Class) does (can be null) // recursion sets whether to find indirect references (true), or only direct references (false) // excludeIDs is a list of OTIDs which we don't want to include and don't want to recurse through (can be null) ArrayList<OTID> directReferences = otrunk.getReferences(otObj.getGlobalId(), null, false, null); ArrayList<OTID> allReferences = otrunk.getReferences(otObj.getGlobalId(), null, true, null); ArrayList<OTID> allDocumentReferences = otrunk.getReferences(otObj.getGlobalId(), OTDocument.class, true, null); ArrayList<OTID> allReferencesExceptSome = otrunk.getReferences(otObj.getGlobalId(), null, true, ignoreObject.getGlobalId()); Common error messages and solutionsErrors when loading an otml fileQ. I'm getting an error that says can't find handler for: .... What does that mean? Errors when loading an otml fileQ. I'm importing a class in the imports section, but I'm still getting an error that says Error importing class: ... this class was listed as an import in the otml file. I checked the spelling of the package and the class and looks right. What's wrong? Errors while loading a realObjectQ. I'm trying to load in a real Object and I get the following error Can't find a controller for this otObject: .... OTrunk ScriptingQ. I followed all the steps for creating an otml file with a script on it (JavaScript), but I'm getting a bunch of errors when I try to run it. Here are some of the errors I've gotten: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/bsf/BSFManager Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.bsf.BSFManager.<init> org.apache.bsf.BSFManager loadScriptingEngine SEVERE: Exception: java.lang.NoClassDefFoundError: org/mozilla/javascript/Scriptable unable to load language: javascript-db: java.lang.NoClassDefFoundError: org/mozilla/javascript/Scriptable java.lang.RuntimeException: org.apache.bsf.BSFException: unable to load language: javascript-db A. You need to add the necessary jar files for the JavaScript engine. The jar files are located in the thirdparty project in cvs. For JavaScript, the files needed are: bsf-2.4.0.jar, js-1.6R5.jar and commons-logging.jar. Add these to your classpath and it should solve the problem. |
Document generated by Confluence on Jan 27, 2014 16:52 |